#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 
# Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
# 

"""
File: unit7.py
Author: zhangyang(zhangyang40@baidu.com)
Date: 2018/2/5 下午2:45
"""
import warnings

warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim')
import logging

logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)

from gensim.models import word2vec

if __name__ == '__main__':
    # 引入数据集
    raw_sentences = ["the quick brown fox jumps over the lazy dogs", "yoyoyo you go home now to sleep"]

    # 切分词汇
    sentences = [s.split() for s in raw_sentences]

    # 构建模型
    model = word2vec.Word2Vec(sentences, min_count=1)

    # 进行相关性比较
    model.similarity('dogs', 'you')
